package chances.training.lombok.ctrl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import chances.training.lombok.entity.User;
import chances.training.lombok.repo.UserRepository;
import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {
	@Autowired
	UserRepository userRepository;
	
	@GetMapping("/find")
	public List<User> findUser(){
		List<User> result = userRepository.findAll();
		for(User user: result) {
			log.debug("user:{}",user);
		}
		return result;
	}
}
